package com.bingyuan.aipassproject.view.adapter

import android.graphics.Color
import com.bingyuan.aipassproject.R
import com.bingyuan.aipassproject.entity.GetScoreListResponse
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class ScoreRecordAdapter :BaseQuickAdapter<GetScoreListResponse.ListBean.DataBean,BaseViewHolder>(R.layout.item_score_record){
    override fun convert(holder: BaseViewHolder, item: GetScoreListResponse.ListBean.DataBean) {
        if (holder.layoutPosition%2==0){
            holder.setBackgroundColor(R.id.llBg,Color.parseColor("#FFF3EA"))
        }else{
            holder.setBackgroundColor(R.id.llBg,Color.parseColor("#F8EADD"))
        }
        holder.setText(R.id.tvDate,item.created)
        holder.setText(R.id.tvType,item.reason)
        if (item.score.equals("0.00")){
            if (item.lock_score.toFloat()>0){
                holder.setTextColor(R.id.tvScore,Color.parseColor("#FF6147"))
            }else{
                holder.setTextColor(R.id.tvScore,Color.parseColor("#69BC4C"))
            }
            holder.setText(R.id.tvScore,item.lock_score)
        }else{
            if (item.score.toFloat()>0){
                holder.setTextColor(R.id.tvScore,Color.parseColor("#FF6147"))
            }else{
                holder.setTextColor(R.id.tvScore,Color.parseColor("#69BC4C"))
            }
            holder.setText(R.id.tvScore,item.score)
        }

    }
}